﻿using System;

namespace CommonEngine
{
    public abstract class Agent_Msg
    {
        /// <summary>
        /// 查询ID
        /// </summary>
        public string SelectId { get; set; }
    }

    public abstract class Agent_Command
    {
        public string OrderCode { get; set; }   //工单编号
        public string Reference { get; set; }   //涉及参考
    }

    public abstract class Agent_Event
    {
        public string OrderCode { get; set; }
        public string Reference { get; set; }   //涉及参考
        public bool IsValid { get; set; }
        public DateTime Timestamp { get; set; } = DateTime.Now;
        /// <summary>
        /// 扩展复制
        /// </summary>
        public T WithTimestamp<T>(DateTime timestamp) where T : Agent_Event
        {
            T result = (T)this.MemberwiseClone();
            result.OrderCode = this.OrderCode;
            result.Reference = this.Reference;
            result.IsValid = this.IsValid;
            result.Timestamp = timestamp;
            return result;
        }
    }
}
